/*
 * Copyright (c) 2016 moondev.cn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package cn.moondev.moonlog.example.moonlog.monitor.dao;

import java.util.List;
import java.util.Map;

import cn.moondev.moonlog.example.moonlog.monitor.entity.BizMonitor;
import org.apache.ibatis.annotations.Param;


public interface BizMonitorDao {

	/**
	 * 批量保存BizMonitor对象
	 * @param sqls	BizMonitor对象列表
	 * @return		更新条数
	 */
	public int save(@Param("list") List<BizMonitor> sqls, @Param("tableName") String tableName);

	/**
	 * 查询BizMonitor列表 
	 * 
	 * @return
	 */
	public List<BizMonitor> list(@Param("sysname") String sys, @Param("start") long start, @Param("end") long end,
								 @Param("tableName") String tableName, @Param("first") int first, @Param("size") int size);
	
	/**
	 * 计算BizMonitor对象数量
	 * 
	 * @return
	 */
	public long count(@Param("sysname") String sys, @Param("start") long start, @Param("end") long end,
					  @Param("tableName") String tableName);
	
	/**
	 * 查询BizMonitor列表 
	 * 
	 * @return
	 */
	public List<BizMonitor> listByDate(@Param("sysname") String sys, @Param("date") String date,
									   @Param("tableName") String tableName, @Param("first") int first, @Param("size") int size);
	
	/**
	 * 计算BizMonitor对象数量
	 * 
	 * @return
	 */
	public long countByDate(@Param("sysname") String sys, @Param("date") String date, @Param("tableName") String tableName);
	
	/**
	 * 调用次数排行
	 * 
	 * @return
	 */
	public List<Map<String, Object>> calcInvokeTimes(@Param("sysname") String sys, @Param("first") int first,
													 @Param("size") int size, @Param("start") long start, @Param("end") long end,
													 @Param("date") String date, @Param("tableName") String tableName);
	
	/**
	 * 算数
	 * 
	 * @return
	 */
	public long countInvokeTimes(@Param("sysname") String sys, @Param("start") long start, @Param("end") long end,
								 @Param("date") String date, @Param("tableName") String tableName);
}
